<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
#parse("/linkandscript.html")
<title>论坛控</title>
</head>
<body>


<div>
    <table width="80%" border="0" class="center">
      <tr>
        <td>网站名称</td>
        <td><input id="sitename" type="text" value="$!forum.getSite().getSitename()" oldvalue="$!forum.getSite().getSitename()" style="width:100px"/></td>
        <td>网站ID</td>
        <td><input id="siteid" type="text" value="$!forum.getSite().getId()" oldvalue="$!forum.getSite().getId()" style="width:100px"/></td>
      </tr>
      
      <tr>
        <td>版块名称</td>
        <td><input id="forumname" type="text" value="$!forum.getName()" oldvalue="$!forum.getName()" style="width:100px"/></td>
        <td>版块数字</td>
        <td><input id="forumcode" type="text" value="$!forum.getForumcode()" oldvalue="$!forum.getForumcode()" style="width:100px"/></td>
      </tr>
      
      <tr>
        <td>版块ID</td>
        <td><input id="forumid" type="text" value="$!forum.getId()" oldvalue="$!forum.getId()" style="width:100px"/></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      

       


      <tr>
        <td>域名</td>
        <td colspan="3"><input id="domain" type="text" value="$!forum.getSite().getDomain()" oldvalue="$!forum.getSite().getDomain()" style="width:400px"/></td>
      </tr>
      <tr>
        <td>论坛地址格式</td>
        <td colspan="3"><input id="urlp" type="text" value="$!forum.getSite().getUrlp()" oldvalue="$!forum.getSite().getUrlp()" style="width:800px"/><br>$!forum.getFirstListpageUrl()</td>
      </tr>
      <tr>
        <td>登录form target</td>
        <td colspan="3"><input id="loginurl" type="text" value="$!forum.getSite().getLoginurl()" oldvalue="$!forum.getSite().getLoginurl()" style="width:800px"/></td>
      </tr>
      <tr>
        <td>用户名密码组合</td>
        <td colspan="3"><input id="loginparas" type="text" value="$!forum.getSite().getLoginparas()" oldvalue="$!forum.getSite().getLoginparas()" style="width:800px"/></td>
      </tr>
      <tr>
        <td>帖子格式</td>
        <td><input id="trp" type="text" value="$!forum.getSite().getTrp()"  oldvalue="$!forum.getSite().getTrp()" style="width:100px"/></td>
        <td>帖子标题格式</td>
        <td><input id="titlep" type="text" value="$!forum.getSite().getTitlep()" oldvalue="$!forum.getSite().getTitlep()" style="width:100px"/></td>
      </tr>

      <tr>
        <td>URL包含关键字</td>
        <td><input id="urlkeyword" type="text" value="$!forum.getSite().getUrlkeyword()" oldvalue="$!forum.getSite().getUrlkeyword()" style="width:100px"/></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>帖子内容格式</td>
        <td colspan="3"><input id="contentp" type="text" value="$!forum.getSite().getContentp()" oldvalue="$!forum.getSite().getContentp()" style="width:400px"/></td>
      </tr>
      
      
      <tr>
        <td>分组</td>
        <td><input id="groups" type="text" value="$!forum.getGroups()" oldvalue="$!forum.getGroups()" style="width:100px"/></td>
        <td>喜爱程度</td>
        <td><input id="priority" type="text" value="$!forum.getPriority()" oldvalue="$!forum.getPriority()" style="width:100px"/></td>
      </tr>
      <tr>
        <td>是否有效</td>
        <td><input id="enabled" type="text" value="$!forum.isEnabled()" oldvalue="$!forum.isEnabled()" style="width:100px"/></td>
        <td>停止访问列表页</td>
        <td><input id="stopindex" type="text" value="$!forum.getStopindex()" oldvalue="$!forum.getStopindex()" style="width:100px"/></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><a id="savebtn" class="btn btn-info">保存</a></td>
        <td>&nbsp;</td>
      </tr>
    </table>
</div>

<div id="forumjson">
明文:$!forum.getJsonStr()
</div>


</body>
<script language="javascript">
$(function(){
	
	$("input").blur(function(){
		forum = "$!forum.getId()";
		key = $(this).attr("id");
		newvalue = $(this).val();
		oldvalue = $(this).attr("oldvalue");
		
		if(oldvalue != newvalue){
			$(this).attr("oldvalue",newvalue);
			console.log(forum + ":" + key + ":" +  oldvalue + "->" + newvalue);
			
			$.post('/hezi/forum?action=update',{forum: forum, 
								key: key,
								newvalue:newvalue,
								},function(theback)
			  {
				console.log("back:" + theback);
				consolelog(theback);
				}
			);
			
		}
		
	});
	
	
	
	$("#savebtn").click(function(){
		var forum = prepareForumJson();
		var str = JSON.stringify(forum);
		$("#forumjson").html(str);
	});	
	
	
	
})



function prepareForumJson(){
		var site = {};
		site.id = $("#siteid").val();
		site.name = $("#sitename").val();
		site.domain = $("#domain").val();
		site.urlp = $("#urlp").val();
		site.trp = $("#trp").val();
		site.titlep = $("#titlep").val();
		site.urlkeyword = $("#urlkeyword").val();
		site.contentp = $("#contentp").val();
		
		var forum = {};
		forum.site = site;
		forum.id = $("#forumid").val();
		forum.code = $("#forumcode").val();
		forum.name = $("#forumname").val();
		
		forum.groups = $("#groups").val();
		forum.priority = $("#priority").val();
		
		
		console.log("site json:");
		console.log(site);		
		console.log("forum json:");
		console.log(forum);	
		
		return forum;
}

</script>
</html>